

public class ConvertViToLatin1 {

	public static final String STRING_VI = "àÀảẢãÃáÁạẠăĂằẰẳẲẵẴắẮặẶâÂầẦẩẨẫẪấẤậẬđĐèÈẻẺẽẼéÉẹẸêÊềỀểỂễỄếẾệỆìÌỉỈĩĨíÍịỊòÒỏỎõÕóÓọỌôÔồỒổỔỗỖốỐộỘơƠờỜởỞỡỠớỚợỢùÙủỦũŨúÚụỤưƯừỪửỬữỮứỨựỰýÝ :+\\<>\"*,!?%$=@#~[]`|^";
	public static final String STRING_LATIN = "aAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAdDeEeEeEeEeEeEeEeEeEeEeEiIiIiIiIiIoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOuUuUuUuUuUuUuUuUuUuUuUyY____\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
	
	public static final char [] CHARACTERS_VI = STRING_VI.toCharArray();
	public static final char [] CHARACTERS_LATIN = STRING_LATIN.toCharArray();
	
	public String convertToLatin(String viString) {
		char [] viChars = viString.toCharArray();
		char [] latinChars = new char[viChars.length];
		boolean check; // check = true if viChar is a special vi character
		
		for (int i = 0; i < viChars.length; i++) {
			
			check = false;
			char viChar = viChars[i];
			
			if (viChar != ' ') {// check if viChar is a space
				for (int j = 0; j < CHARACTERS_VI.length; j++) {
					if (viChar == CHARACTERS_VI[j]) {
						latinChars[i] = CHARACTERS_LATIN[j];
						check = true;
						break;
					}
				}
			}
			
			if (check == false) // if vichar is not a special vi character
				latinChars[i] = viChar;
		}
		return new String(latinChars);
	}
	
	
	
}
